{extend name="admin@index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">添加广告位</div>
    <div class="layui-card-body">
        <form class="layui-form form-horizontal" action="" method="post">
            <input type="hidden" name="position_id" value="{$poist_id}">
            <div class="layui-form-item">
                <label>广告名称</label>
                <div class="w300">
                    <input type="text" name="title" autocomplete="off" placeholder="广告名称" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label>广告英文名称</label>
                <div class="w300">
                    <input type="text" name="name" autocomplete="off" placeholder="广告英文名称" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label>广告url</label>
                <div class="w300">
                    <input type="text" name="url" autocomplete="off" placeholder="广告url 例如：http:// || https://" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item" >

                    <label class="w300">背景颜色</label><br>


                <div  class="layui-inline">
                    <input type="text" name="bg_color" autocomplete="off" placeholder="背景颜色 例如：#fff" class="layui-input"  id="test-form-input">
                </div>
                <div class="layui-inline" style="left: -11px;">
                    <div id="test-form"></div>
                </div>
            </div>



            <div class="layui-form-item layui-form-text">
                <label>pc广告图片</label>
                <div class="layui-form-field-label">
                    <div class="js-upload-image">
                        {php}echo \util\Form::images('thumb'){/php}
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label>手机广告图片</label>
                <div class="layui-form-field-label">
                    <div class="js-upload-image">
                        {php}echo \util\Form::images('m_thumb'){/php}
                    </div>
                </div>
            </div>
            <div class="layui-form-item web_seo">
                <label>起止时间</label>
                <div class="w300">

                    <input type="text" name="start_time" id="start_time" autocomplete="off" placeholder="起止时间" class="layui-input">
                </div>
            </div>
           <!-- <div class="layui-form-item web_seo">
                <label>结束时间</label>
                <div class="w300">
                    <input type="text" name="end_time" id="end_time" autocomplete="off" placeholder="结束时间" class="layui-input">

                </div>
            </div>-->

            <div class="layui-form-item">
                <label>栏目id</label>
                <div class="w300">
                    <input type="text" name="cat_id" autocomplete="off" placeholder="栏目id 例如：1,2" class="layui-input">
                </div>
            </div>




            <div class="layui-form-item">
                <label>排序</label>
                <div class="w300">
                    <input type="number" name="listorder" autocomplete="off" placeholder="排序" class="layui-input" value="100">
                </div>
            </div>
            <div class="layui-form-item">
                <label>是否显示</label>
                <div class="w300">
                    <input type="radio" name="is_show" value="1" checked title="开启" lay-filter="is_show">
                    <input type="radio" name="is_show" value="0" title="禁用" lay-filter="is_show">
                </div>
            </div>
            <div class="layui-form-item web_seo">
                <label>广告描述</label>
                <div class="w300">
                    <textarea name="description" placeholder="广告描述" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div>
                    <button class="layui-btn ajax-post" lay-submit lay-filter="*" target-form="form-horizontal">立即提交</button>
                    <button class="layui-btn layui-btn-normal" onclick="javascript :history.back(-1);">返回</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__STATIC__/admin/js/common.js"></script>
<script type="text/javascript" src="__STATIC__/libs/viewer/viewer.min.js"></script>
<link rel="stylesheet" href="__STATIC__/libs/viewer/viewer.min.css">
<script type="text/javascript">
$('.uploader-list').each(function () {
    $(this).viewer();
});
</script>
<script>
    layui.use(['laydate','colorpicker'], function(){
        var laydate = layui.laydate;
        var colorpicker = layui.colorpicker;

        //执行一个laydate实例
        //年范围
        laydate.render({
            elem: '#start_time'
            ,range: true
        });
        //表单赋值
        colorpicker.render({
            elem: '#test-form'
            ,color: '#1c97f5'
            ,done: function(color){
                $('#test-form-input').val(color);
            }
        });
    });
</script>
{/block}